import java.util.Scanner;

public class YangHui_triangle {

	public static void main(String[] args) {

		System.out.print("Please input the lines to genereate:");
		final int n = new Scanner(System.in).nextInt();

		int[][] ary = generateParscal(n);

		for(int[] item: ary){
			for(int value: item){
				System.out.print((value > 0? value: " "));
			}
			System.out.println();
		}

	}

	private static int[][] generateParscal(final int n) {
		int[][] ary = new int[n][2*n-1];

		for(int i = 0; i < ary.length; i++){
			for(int j = 0; j < ary[i].length; j++){
				if(Math.abs(j - (n-1)) == i){
					ary[i][j] = 1;
				}
			}

			try{
				int position = n - i;

				do{
					ary[i][position]= ary[i-1][position-1] + ary[i-1][position+1];
					position++;
				}while(ary[i-1][position] != 1);
			}catch(ArrayIndexOutOfBoundsException exp){
				continue;
			}

		}
		return ary;
	}

}
